//
//  HEOrderChildInfo.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/11/6.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HEOrderChildInfo.h"

@implementation HEOrderChildInfo

- (NSMutableAttributedString *)KtotalAmount {
    if (!_KtotalAmount) {
        
 
        NSString * total = [NSString stringWithFormat:@"补单金额 ￥%@",[NSDecimalNumber rounding:_totalAmount afterPoint:2]];
        
        NSDictionary *attributes = @{ NSFontAttributeName:DYFont(16), NSForegroundColorAttributeName: [UIColor blackColor] };

        NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString: total attributes:attributes];
        NSRange loc = [[text string] rangeOfString:@"￥"];
        
        NSInteger start = loc.location;
        NSInteger len = total.length - loc.location;
        
        //设置高亮色和点击事件
        [text yy_setTextHighlightRange:NSMakeRange(start, len) color:CPriceColor backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
        }];
        
        [text addAttribute:NSFontAttributeName value:DYBlodFont(16) range:NSMakeRange(start, len)];

        _KtotalAmount = text;
    }
    return _KtotalAmount;
}

- (NSString *)KStatusText {
    if (!_KStatusText) {
        if (_state == HEOrderStatusWaitPay) {
           _KStatusText = [HEEnums orderStatusToText: _state];
        }else {
            _KStatusText = [HEEnums welfareStatusToText:_welfare_status];
        }
    }
    return _KStatusText;
}

@end
